package cn.hl.feign;

import cn.hl.domain.Employee;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
public class EmployeeServerFallBackFactory implements FallbackFactory<EmployeeServer> {

    @Override
    public EmployeeServer create(Throwable throwable) {
        return new EmployeeServer() {
            @Override
            public Employee getById(Long id) {
                return new Employee(-1L,"熔断触发","服务不可用，请稍后重试！");
            }
        };
    }
}
